package com.dyh.quickdemo.GoodsRules;



import java.util.ArrayList;
import java.util.List;
import java.util.function.Function;

/*
@Author=Joey Wheeler
@Date=2021/3/6 10:43
*/
public class Rule$1Builder<T,V1> extends BaseRuleBuilder<Rule$1<T,V1>>{

    private List<CheckerAndTip<Checker$1<V1>>> checkerAndTips;

    public static <T,V1> Rule$1Builder<T,V1> when(Function<T,V1> mapper){
        Rule$1Builder builder = new Rule$1Builder();
        builder.mappers = new Function[]{mapper};
        builder.checkerAndTips = new ArrayList();
        return builder;
    }


    public Rule$1Builder<T,V1> must(Checker$1<V1> checker,String tip){
        this.checkerAndTips.add(new CheckerAndTip(checker,tip));
        return this;
    }

    @Override
    public  Rule$1<T, V1> build() {
        return new Rule$1<>((Function<T, V1>) mappers[0],checkerAndTips);
    }

}
